

<?php

$menumark = 'server';
switch ($act) {
    //#####################@ 修改分类 @#####################//
    case 'edit':
        if(isGet()){
            $server = $db->pe_select('server',array('server_id'=>$_g_id));
            include(pe_tpl('server_edit.html'));
        }else if(isPost()){
            $data['server_name'] = $_POST['servername'];
            if ($_FILES['serverimg']['size']) {
                pe_lead('include/class/upload.class.php');
                $upload = new upload($_FILES['serverimg']);
                $data['server_img'] = $upload->filehost;
            }
            $result = $db->pe_update('server',array('server_id'=>$_g_id),$data);
//            echo $result;exit;
            if($result){
                pe_success('修改成功');
            }else{
                pe_error('修改失败');
            }



            $seo = pe_seo($menutitle='酒店措施增加', '', '', 'admin');
            include(pe_tpl('server_add.html'));


        }
        include(pe_tpl('server_edit.html'));
        break;

    case 'add':
        if(isGet()){
            $server = $db->pe_selectall('server');
//            mp($server);
            include(pe_tpl('server_add.html'));
        }else if(isPost()){
            $data['server_name'] = $_POST['servername'];
            if ($_FILES['serverimg']['size']) {
                pe_lead('include/class/upload.class.php');
                $upload = new upload($_FILES['serverimg']);
                $data['server_img'] = $upload->filehost;
            }
            $result = $db->pe_insert('server',$data);
//            echo $result;exit;
            if($result){
                pe_success('添加成功','admin.php?mod=server&act=add');
            }else{
                pe_error('添加失败');
            }



            $seo = pe_seo($menutitle='酒店措施增加', '', '', 'admin');
            include(pe_tpl('server_add.html'));


        }

        break;

    case 'del':
        if($db->pe_delete('server',array('server_id'=>$_g_id))){
            pe_success('删除成功','admin.php?mod=server');
        }else{
            pe_error('删除失败','admin.php?mod=server');
        }


        break;


    //冻结会员卡
    case 'cool':
        if($db->pe_update('server',array('server_id'=>$_g_id),array('server_state'=>1))){
            pe_success('隐藏成功','admin.php?mod=server');
        }else{
            pe_error('隐藏失败','admin.php?mod=server');
        }
        include(pe_tpl('server_list.html'));
        break;


    case 'recover':
        if($db->pe_update('server',array('server_id'=>$_g_id),array('vipcard_state'=>0))){
            pe_success('显示成功','admin.php?mod=server');
        }else{
            pe_error('显示失败','admin.php?mod=server');
        }
        include(pe_tpl('server_list.html'));
        break;

    //#####################@ 分类列表 @#####################//
    default :
        $server  = $db->pe_selectall('server');
        include(pe_tpl('server_list.html'));

        break;


    /**
     * 是否是AJAx提交的
     * @return bool
     */


}

